home *** CD-ROM | disk | FTP | other *** search
- package com.sun.java.swing.text;
-
- import java.awt.Component;
- import java.awt.Point;
- import java.awt.Rectangle;
- import java.awt.event.ActionEvent;
-
- class DefaultEditorKit$DownAction extends TextAction {
- private boolean select;
-
- DefaultEditorKit$DownAction(String nm, boolean select) {
- super(nm);
- this.select = select;
- }
-
- public void actionPerformed(ActionEvent e) {
- JTextComponent target = ((TextAction)this).getTextComponent(e);
- if (target != null) {
- try {
- Caret caret = target.getCaret();
- int dot = caret.getDot();
- Point p = caret.getMagicCaretPosition();
- if (p == null) {
- Rectangle r = target.modelToView(dot);
- p = new Point(r.x, r.y);
- caret.setMagicCaretPosition(p);
- }
-
- dot = Utilities.getPositionBelow(target, dot, p.x);
- if (this.select) {
- caret.moveDot(dot);
- } else {
- caret.setDot(dot);
- }
- } catch (BadLocationException var7) {
- ((Component)target).getToolkit().beep();
- }
- }
-
- }
- }
-